import { privateRequest } from '@/utils/request';
import type { IRoleInfo, ISetRoleParams, IDelParams, IDutyParams, IDutyInfo } from './type';

enum API {
	// 角色
	Role = '/system/role',
	// 设置角色
	SetRole = '/system/role/setrole',
	// 删除角色
	DelRole = '/system/role/delrole',
	// 获取拥有职责
	Duty = '/system/role/duty',
	// 设置职责
	SetDuty = '/system/role/setduty',
}

export const useRole = () => privateRequest.get<IRoleInfo[]>(API.Role);
export const useSetRole = (params: ISetRoleParams) => privateRequest.post<string>(API.SetRole, params);
export const useDelRole = (params: IDelParams) => privateRequest.delete<string>(API.DelRole, params);
export const useDuty = (params: IDutyParams) => privateRequest.post<IDutyInfo>(API.Duty, params);
export const useSetDuty = (params: any) => privateRequest.post<string>(API.SetDuty, params);
